package com.googlecode.sqldatagenerator.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.googlecode.sqldatagenerator.model.dto.GeneratorRequestDto;
import com.googlecode.sqldatagenerator.model.dto.GeneratorResponseDto;
import com.googlecode.sqldatagenerator.service.ScriptWriterService;
import com.googlecode.sqldatagenerator.util.Callback;

@Service
public class ScriptWriterServiceImpl implements ScriptWriterService {

    @Override
    public void writeScript(GeneratorRequestDto request, Callback<GeneratorResponseDto> callback) {
        Assert.notNull(callback, "callback must be != null");
        try {
            Assert.notNull(request, "request must be != null");
        
            // TODO: gerar script e colocar no response
            GeneratorResponseDto response = null;
            
            callback.onSuccess(response);
        } catch (Exception e) {
            callback.onError(e);
        }
    }

}
